package com.sig.slider;

import com.sig.MainActivity;

import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

public class SliderClickListener implements View.OnClickListener{

	private MainActivity activity;

	public SliderClickListener(MainActivity activity){
		this.activity = activity;
	}

	private String recupererTexte(View view){
		ViewGroup layout = (ViewGroup)activity.findViewById(view.getId());

		for(int i=0;i<layout.getChildCount();i++){
			View v = layout.getChildAt(i);
			if(v instanceof TextView){
				String texte = ((TextView)v).getText().toString();
				return texte;
			}
		}
		return "";
	}

	public void onClick(View view) {
		String texte = recupererTexte(view);
		activity.selectItem(texte);

	}

}